Completed
Pull Request — master (#81)
by Alejandro
03:28
created

provideServices.js ➔ ???   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 33
Code Lines 22

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 22
nc 1
nop 3
dl 0
loc 33
ccs 0
cts 23
cp 0
crap 2
rs 9.352
c 0
b 0
f 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A provideServices.js ➔ ... ➔ ??? 0 1 1
1
import csvjson from 'csvjson';
2
import CreateServer from '../CreateServer';
3
import ServersDropdown from '../ServersDropdown';
4
import DeleteServerModal from '../DeleteServerModal';
5
import DeleteServerButton from '../DeleteServerButton';
6
import ImportServersBtn from '../helpers/ImportServersBtn';
7
import { resetSelectedServer, selectServer } from '../reducers/selectedServer';
8
import { createServer, createServers, deleteServer, listServers } from '../reducers/server';
9
import ServersImporter from './ServersImporter';
10
import ServersService from './ServersService';
11 4
import ServersExporter from './ServersExporter';
12
13
const provideServices = (bottle, connect, withRouter) => {
14
  // Components
15
  bottle.serviceFactory('CreateServer', CreateServer, 'ImportServersBtn');
16
  bottle.decorator('CreateServer', connect([ 'selectedServer' ], [ 'createServer', 'resetSelectedServer' ]));
17
18
  bottle.serviceFactory('ServersDropdown', ServersDropdown, 'ServersExporter');
19
  bottle.decorator('ServersDropdown', connect([ 'servers', 'selectedServer' ], [ 'listServers', 'selectServer' ]));
20
21
  bottle.serviceFactory('DeleteServerModal', () => DeleteServerModal);
22
  bottle.decorator('DeleteServerModal', withRouter);
23
  bottle.decorator('DeleteServerModal', connect(null, [ 'deleteServer' ]));
24
25
  bottle.serviceFactory('DeleteServerButton', DeleteServerButton, 'DeleteServerModal');
26
27
  bottle.serviceFactory('ImportServersBtn', ImportServersBtn, 'ServersImporter');
28
  bottle.decorator('ImportServersBtn', connect(null, [ 'createServers' ]));
29
30
  // Services
31
  bottle.constant('csvjson', csvjson);
32
  bottle.constant('window', global.window);
33
  bottle.service('ServersImporter', ServersImporter, 'csvjson');
34
  bottle.service('ServersService', ServersService, 'Storage');
35
  bottle.service('ServersExporter', ServersExporter, 'ServersService', 'window', 'csvjson');
36
37
  // Actions
38
  bottle.serviceFactory('selectServer', selectServer, 'ServersService');
39
  bottle.serviceFactory('createServer', createServer, 'ServersService');
40
  bottle.serviceFactory('createServers', createServers, 'ServersService');
41
  bottle.serviceFactory('deleteServer', deleteServer, 'ServersService');
42
  bottle.serviceFactory('listServers', listServers, 'ServersService');
43
44
  bottle.serviceFactory('resetSelectedServer', () => resetSelectedServer);
45
};
46
47
export default provideServices;
48